version: '3.9'

services:
  postgres:
    container_name: postgres_container
    image: postgres:latest
    environment:
      POSTGRES_DB: "rosd"
      POSTGRES_USER: "postgres"
      POSTGRES_PASSWORD: "postgres"
      PGDATA: "/var/lib/postgresql/data/pgdata"
    volumes:
      - ../2. Init Database:/docker-entrypoint-initdb.d
      - .:/var/lib/postgresql/data
    ports:
      - "5432:5432"
    restart: unless-stopped
    deploy:
      resources:
        limits:
          cpus: '1'
          memory: 4G
    networks:
      - postgres

  pgadmin:
    container_name: pgadmin_container
    image: dpage/pgadmin4:latest
    environment:
      PGADMIN_DEFAULT_EMAIL: "support@dievdo.ru"
      PGADMIN_DEFAULT_PASSWORD: "postgres"
      PGADMIN_CONFIG_SERVER_MODE: "False"
      PGADMIN_DISABLE_POSTFIX: "True"
      PGADMIN_LISTEN_ADDRESS: 0.0.0.0
    volumes:
      - ./pgadmin:/var/lib/pgadmin
    ports:
      - "5050:80"
    restart: unless-stopped
    deploy:
      resources:
        limits:
          cpus: '0.5'
          memory: 1G
    networks:
      - postgres

  rosd:
    container_name: app_container
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
      - ASPNETCORE_URLS=https://+:443;http://+:80
    ports:
      - "80"
      - "443"
    volumes:
      - ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro
      - ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro
    networks:
      - postgres

networks:
  postgres:
    driver: bridge
